//
//  YZPigDocBaseInfoCell.m
//  VET
//
//  Created by YZ on 2018/7/19.
//  Copyright © 2018年 YZ. All rights reserved.
//

#import "YZPigDocBaseInfoCell.h"

@interface YZPigDocBaseInfoCell ()

@property (nonatomic, strong) UILabel *titleLb;

@property (nonatomic, strong) UILabel *contentLb;

@end

@implementation YZPigDocBaseInfoCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.layer.masksToBounds = YES;
        [self.contentView addSubview:self.titleLb];
        [self.contentView addSubview:self.contentLb];
        
        [self makeContraints];
    }
    return self;
}

- (void)makeContraints
{
    [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kCurrentDeviceNum(20));
        make.top.mas_equalTo(kCurrentDeviceNum(10));
        make.width.mas_lessThanOrEqualTo(200);
    }];
    
    [self.contentLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLb);
        make.right.equalTo(self.contentView.mas_right).offset(-kCurrentDeviceNum(20));
        make.width.mas_lessThanOrEqualTo(200);
    }];
}

#pragma mark -- setters && getters

- (UILabel *)titleLb
{
    if (!_titleLb) {
        _titleLb =  [UILabel new];
        _titleLb.textAlignment = NSTextAlignmentLeft;
        _titleLb.font = kCurrentDeviceFont(16);
        _titleLb.textColor = kColorWithHex(0x393939);
    }
    return _titleLb;
}

- (UILabel *)contentLb
{
    if (!_contentLb) {
        _contentLb =  [UILabel new];
        _contentLb.textAlignment = NSTextAlignmentRight;
        _contentLb.font = kCurrentDeviceFont(16);
        _contentLb.textColor = kColorWithHex(0x434343);
    }
    return _contentLb;
}

- (void)setModel:(YZPigDocBaseInfoModel *)model
{
    _model = model;
    self.titleLb.text = model.title;
    self.contentLb.text = model.content;
}
@end
